import * as Cesium from '@cesiumjs';

var bcou = void 0;

/**
 * Pin用来展示一个兴趣点
 * @memberof Obj
 * @class
 * @extends XbsjCzmObj
 */

var Pin = function(_XbsjCzmObj) {
  (0, _inherits3.default)(Pin, _XbsjCzmObj);

  function Pin(earth, guid) {
    (0, _classCallCheck3.default)(this, Pin);

    // enabled和show关联的话，加入还有div等的看见与否，就没法通过enabled来控制了，所以还是分开好
    // 但是enabled以后，show虽然为true，但是仍然不可见。
    // this.disposers.push(bind(this, 'enabled', this, 'show'));

    var _this = (0, _possibleConstructorReturn3.default)(this, (Pin.__proto__ || (0, _getPrototypeOf2.default)(Pin)).call(this, earth, guid));

    _XbsjBase2.default.registerPosition(_this);

    // 此处的目的是为了解决Billboard导致拾取结果不准的问题
    // TODO(vtxf): 以后应该改成针对特定的collection,而不是把整个类都修改了！
    if (!bcou) {
      bcou = Cesium.BillboardCollection.prototype.update;
      Cesium.BillboardCollection.bcou = bcou;
      Cesium.BillboardCollection.prototype.update = function(frameState) {
        if (typeof Cesium.BillboardCollection.xbsjForceRSOpaqueDepthMask === 'undefined') {
          Cesium.BillboardCollection.xbsjForceRSOpaqueDepthMask = false;
        }

        if (!this._rsOpaque || this._rsOpaque.depthMask !== Cesium.BillboardCollection
          .xbsjForceRSOpaqueDepthMask) {
          this._rsOpaque = Cesium.RenderState.fromCache({
            depthTest: {
              enabled: true,
              func: Cesium.WebGLConstants.LESS
            },
            depthMask: Cesium.BillboardCollection.xbsjForceRSOpaqueDepthMask
          });
        }
        bcou.call(this, frameState);
      };
    }

    _XbsjBase2.default.registerProperty(_this, 'pinBuilder');
    _this.disposers.push((0, _registerInteractionProperty.registerPositionEditing)(_this._earth, _this, {
      positionEditingProperty: 'editing'
    }));
    _this.disposers.push((0, _registerInteractionProperty.registerPositionPicking)(_this._earth, _this, {
      positionPickingProperty: 'creating'
    }));

    _this.disposers.push((0, _registerInteractionProperty.registerCameraTracking)(_this._earth, _this, {
      cameraAttachedFunc: function cameraAttachedFunc(tracking) {
        var _this2 = this;

        var disposers = [];

        disposers.push((0, _track2.default)(tracking, 'position', this, 'position'));
        // disposers.push(track(tracking, 'rotation', target, 'rotation'));
        tracking.rotation = [0, -Math.PI / 3, 0];
        disposers.push((0, _track2.default)(tracking, 'viewDistance', this, 'viewDistance'));
        this._earth.camera.tracking.isCameraLike = false;

        disposers.push((0, _mobx.reaction)(function() {
          return {
            position: [].concat((0, _toConsumableArray3.default)(_this2.position)),
            cameraAttachedOffsetPosition: [].concat((0, _toConsumableArray3.default)(_this2
              .cameraAttachedOffsetPosition)),
            cameraAttachedOffsetRotation: [].concat((0, _toConsumableArray3.default)(_this2
              .cameraAttachedOffsetRotation)),
            viewDistance: _this2.viewDistance
          };
        }, function(prv) {
          for (var i = 0; i < 3; ++i) {
            tracking.position[i] = prv.position[i] + prv.cameraAttachedOffsetPosition[i];
            tracking.rotation[i] = prv.cameraAttachedOffsetRotation[i];
          }
          tracking.viewDistance = prv.viewDistance;
        }));
        this._earth.camera.tracking.isCameraLike = false;

        return function() {
          disposers.forEach(function(d) {
            return d();
          });
          disposers.length = 0;
        };
      }
    }));

    _this._pinBuilder = _this._earth._pinBuilder;
    var viewer = _this._earth.czm.viewer;

    (0, _mobx.extendObservable)(_this, {
      _winPos: [0, 0, 0, 0], // [left, top, right, bottom]
      /**
       * pin的屏幕坐标，是一个数组，包含四个元素，分别表示[left, top, right, bottom]，注意是该属性是只读的。
       * @type {array}
       * @instance
       * @readonly
       * @default [0, 0, 0, 0]
       * @memberof Obj.Pin
       */
      get winPos() {
        return this._winPos;
      }
    }, {
      winPos: _mobx.computed
    });

    _this._cartesian = new Cesium.Cartesian3();
    _this._winCartesian = new Cesium.Cartesian2();

    var updateWinPos = function updateWinPos() {
      if (!_this.computingWinPos && !(_this.imageUrl && _this.isDivImage)) {
        return;
      }

      try {
        var _Cesium$Cartesian;

        var scene = _this._earth.czm.scene;
        var cartesian = (_Cesium$Cartesian = Cesium.Cartesian3).fromRadians.apply(_Cesium$Cartesian, (0,
          _toConsumableArray3.default)(_this.position).concat([undefined, _this._cartesian]));
        if (cartesian) {
          var winCart = scene.cartesianToCanvasCoordinates(cartesian, _this._winCartesian);
          if (winCart) {
            // 修复devicePixelRatio变化时，winPos对不上的问题
            // this._winPos.splice(0, 2, winCart.x, scene.drawingBufferHeight - winCart.y);
            var h = earth.czm.viewer.canvas.clientHeight;
            var w = earth.czm.viewer.canvas.clientWidth;
            _this._winPos.splice(0, 4, winCart.x, winCart.y, w - winCart.x, h - winCart.y);
          }
        }
      } catch (error) {
        console.warn('Pin计算窗口坐标时有误');
      }
    };

    // this.position发生变化时，更新窗口坐标
    _this.disposers.push((0, _mobx.autorun)(function() {
      return updateWinPos();
    }));

    // 相机和窗口尺寸变化时，更新窗口坐标
    _this.disposers.push(function() {
      var earth = _this._earth;
      var mergeSource = rxjs.race(earth.eventSource.contextSizeChanged, earth.eventSource.cameraChanged);
      var subscription = mergeSource.subscribe(updateWinPos);
      return function() {
        subscription.unsubscribe();
      };
    }());

    _this._position = Cesium.Cartesian3.fromDegrees(0, 0, 0);
    _this._billboardEnt = viewer.entities.add({
      name: _this.name,
      position: _this._position,
      point: {
        pixelSize: 5.0,
        color: Cesium.Color.YELLOW,
        outlineColor: Cesium.Color.BLACK,
        outlineWidth: 1.0
        // distanceDisplayCondition: distanceDisplayCondition,
        // translucencyByDistance: translucencyByDistance,
        // disableDepthTestDistance: Number.POSITIVE_INFINITY,
      },
      billboard: {
        // image : pinBuilder.fromColor(Cesium.Color.RED, 48, Cesium.Color.YELLOW).toDataURL(),
        // image : pinBuilder.fromMakiIconId('car', Cesium.Color.DARKGREEN, 96, Cesium.Color.WHITE),
        verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
        horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
        scale: 1.0
      },
      label: (0, _defineProperty3.default)({
        text: '',
        style: Cesium.LabelStyle.FILL_AND_OUTLINE,
        font: '48px 楷体',
        fillColor: Cesium.Color.WHITE,
        outlineColor: Cesium.Color.BLACK,
        outlineWidth: 6,
        scale: 0.5,
        disableDepthTestDistance: 1000000000,
        verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
        horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
        pixelOffset: new Cesium.Cartesian2(20, -25)
      }, 'verticalOrigin', Cesium.VerticalOrigin.BOTTOM),
      polyline: {
        show: false,
        positions: []
      }
    });
    _this.disposers.push(function() {
      viewer.entities.remove(_this._billboardEnt);
    });

    // 配置hovered和onClick属性
    {
      // this._billboardEnt.onclick = pickedObject => this.onclick && this.onclick(pickedObject);
      // const that = this;
      // Object.defineProperty(this._billboardEnt, '_hovered', {
      //     get() {
      //         return that._hovered;
      //     },
      //     set(newVal) {
      //         that._hovered = newVal;
      //     }
      // });
      _this._billboardEnt._xbsjOwner = _this;
    }

    _this.disposers.push(function() {
      _this._billboardEnt && viewer.entities.remove(_this._billboardEnt);
      _this._billboardEnt = undefined;
    });

    _this._fillColor = new(Function.prototype.bind.apply(Cesium.Color, [null].concat((0, _toConsumableArray3
      .default)(_this.pinBuilder.fillColor))))();
    _this._outlineColor = new(Function.prototype.bind.apply(Cesium.Color, [null].concat((0,
      _toConsumableArray3.default)(_this.pinBuilder.outlineColor))))();

    _this.disposers.push((0, _mobx.autorun)(function() {
      var _this$_fillColor, _this$_outlineColor;

      (_this$_fillColor = _this._fillColor).xbsjFromArray.apply(_this$_fillColor, (0,
        _toConsumableArray3.default)(_this.pinBuilder.fillColor));
      (_this$_outlineColor = _this._outlineColor).xbsjFromArray.apply(_this$_outlineColor, (0,
        _toConsumableArray3.default)(_this.pinBuilder.outlineColor));

      // isDivImage用来表示图像是否需要用div来显示，而不是作为三维程序中的一个图片。
      // if (this.imageUrl) {
      //     this._billboardEnt.billboard.image = this.imageUrl;
      // } else if (this.pinBuilder.makiIcon) {
      //     this._billboardEnt.billboard.image = this._pinBuilder.fromMakiIconId(this.pinBuilder.makiIcon, this._outlineColor, this.pinBuilder.size, this._fillColor);
      // } else if (this.pinBuilder.text) {
      //     this._billboardEnt.billboard.image = this._pinBuilder.fromText(this.pinBuilder.text, this._outlineColor, this.pinBuilder.size, this._fillColor);
      // } else {
      //     this._billboardEnt.billboard.image = this._pinBuilder.fromColor(this._outlineColor, this.pinBuilder.size, this._fillColor);
      // }
      if (_this.imageUrl && _this.isDivImage) {
        _this._billboardEnt.show = false;
      } else {
        if (_this.imageUrl && !_this.isDivImage) {
          _this._billboardEnt.billboard.image = _this.imageUrl;
        } else if (_this.pinBuilder.makiIcon) {
          _this._billboardEnt.billboard.image = _this._pinBuilder.fromMakiIconId(_this.pinBuilder
            .makiIcon, _this._outlineColor, _this.pinBuilder.size, _this._fillColor);
        } else if (_this.pinBuilder.text) {
          _this._billboardEnt.billboard.image = _this._pinBuilder.fromText(_this.pinBuilder.text, _this
            ._outlineColor, _this.pinBuilder.size, _this._fillColor);
        } else {
          _this._billboardEnt.billboard.image = _this._pinBuilder.fromColor(_this._outlineColor, _this
            .pinBuilder.size, _this._fillColor);
        }

        _this._billboardEnt.label.outlineColor = _this._outlineColor;
        _this._billboardEnt.label.fillColor = _this._fillColor;

        _this._billboardEnt.polyline.material = _this._outlineColor;
      }
    }));

    (0, _mobx.extendObservable)(_this, {
      _innerShow: false
    });

    var updateInnerShow = function updateInnerShow() {
      var d = _this.position.xepd(_this._earth.camera.position);
      if (d > _this.near && d < _this.far) {
        _this._innerShow = true;
      } else {
        _this._innerShow = false;
      }
    };

    updateInnerShow();
    _this.disposers.push((0, _mobx.reaction)(function() {
      return {
        cameraPos: [].concat((0, _toConsumableArray3.default)(_this._earth.camera.position)),
        pos: [].concat((0, _toConsumableArray3.default)(_this.position)),
        near: _this.near,
        far: _this.far
      };
    }, updateInnerShow));

    var updateDivStyle = function updateDivStyle() {
      if (_this.imageUrl && _this.isDivImage) {
        if (!_this._divImage) {
          var divImage = document.createElement('img');

          _this.earth.czm.viewer.container.appendChild(divImage);
          _this._divImage = divImage;

          _this.disposers.push(function() {
            _this.earth.czm.viewer.container.removeChild(_this._divImage);
            _this._divImage = undefined;
          });
        }

        // this._divImage.src赋值以后会自动改变字符串，所以没法用src来判断是否变化，只能重新设置一个变量_currentImageUrl
        if (!_this._currentImageUrl || _this._currentImageUrl !== _this.imageUrl) {
          _this._divImage.src = _this.imageUrl;
          _this._currentImageUrl = _this.imageUrl;
          _this._divImage.style.position = 'absolute';
          _this._divImage.style.left = '0px';
          _this._divImage.style.bottom = '0px';
          _this._divImage.style.pointerEvents = 'none';
          _this._divImage.style.display = 'none'; // 暂时隐藏

          _this._divImage.onload = function() {
            console.log('divImage onload, width: ', _this._divImage.naturalWidth);
            updateDivStyle();
          };
        }
      }

      var divShow = !!_this.imageUrl && _this.isDivImage && _this._divImage && _this.enabled && _this
        .show && _this._innerShow;
      if (_this._divImage) {
        var _divImage = _this._divImage;
        _divImage.style.display = divShow ? 'block' : 'none';
        _divImage.style.width !== _this.scale * _divImage.naturalWidth + 'px' && (_divImage.style.width =
          _this.scale * _divImage.naturalWidth + 'px');
        _divImage.style.height !== _this.scale * _divImage.naturalHeight + 'px' && (_divImage.style.height =
          _this.scale * _divImage.naturalHeight + 'px');
        _divImage.style.left !== _this.winPos[0] + 'px' && (_divImage.style.left = _this.winPos[0] - _this
          .origin[0] * _divImage.naturalWidth * _this.scale + 'px');
        _divImage.style.bottom !== _this.winPos[3] + 'px' && (_divImage.style.bottom = _this.winPos[3] -
          _this.origin[1] * _divImage.naturalHeight * _this.scale + 'px');
      }

      var billboardShow = _this.enabled && _this.show && !_this.isDivImage;
      _this._billboardEnt.show = billboardShow;
    };

    updateDivStyle();
    _this.disposers.push((0, _mobx.reaction)(function() {
      return {
        enabled: _this.enabled,
        show: _this.show,
        isDivImage: _this.isDivImage,
        _innerShow: _this._innerShow,
        imageUrl: _this.imageUrl,
        origin: [].concat((0, _toConsumableArray3.default)(_this.origin)),
        winPos: [].concat((0, _toConsumableArray3.default)(_this.winPos))
      };
    }, updateDivStyle));

    _this.disposers.push((0, _mobx.autorun)(function() {
      _this._billboardEnt.label.text = _this.pinBuilder.extText;
      _this._billboardEnt.label.font = _this.pinBuilder.extTextFont;
      _this._billboardEnt.label.pixelOffset = new Cesium.Cartesian2(_this.pinBuilder.extTextPixelOffset[
        0], _this.pinBuilder.extTextPixelOffset[1]);
    }));

    (0, _mobx.extendObservable)(_this, {
      _innerScale: 1.0
    });

    _this.disposers.push((0, _mobx.autorun)(function() {
      var _Cesium$Cartesian2;

      _this._billboardEnt.name = _this.name;
      _this._position = (_Cesium$Cartesian2 = Cesium.Cartesian3).fromRadians.apply(_Cesium$Cartesian2, (
        0, _toConsumableArray3.default)(_this.position).concat([undefined, _this._position]));
      _this._billboardEnt.position = _this._position;
      var scale = _this.scale * _this._innerScale;
      _this._billboardEnt.billboard.scale = scale;
    }));

    var updateOrigin = function updateOrigin() {
      var h = [Cesium.HorizontalOrigin.LEFT, Cesium.HorizontalOrigin.CENTER, Cesium.HorizontalOrigin.RIGHT];
      var v = [Cesium.VerticalOrigin.BOTTOM, Cesium.VerticalOrigin.CENTER, Cesium.VerticalOrigin.TOP];
      _this._billboardEnt.billboard.horizontalOrigin = h[_this.origin[0] * 2.0 | 0];
      _this._billboardEnt.billboard.verticalOrigin = v[_this.origin[1] * 2.0 | 0];
    };
    updateOrigin();
    _this.disposers.push((0, _mobx.reaction)(function() {
      return [].concat((0, _toConsumableArray3.default)(_this.origin));
    }, updateOrigin));

    _this._distanceDisplayCondition = new Cesium.DistanceDisplayCondition(_this.near, _this.far);
    _this.disposers.push((0, _mobx.autorun)(function() {
      if (_this.near < _this.far) {
        // near必须小于far，否则会导致三维停止响应
        _this._distanceDisplayCondition.near = _this.near;
        _this._distanceDisplayCondition.far = _this.far;
        _this._billboardEnt.billboard.distanceDisplayCondition = _this._distanceDisplayCondition;
        _this._billboardEnt.point.distanceDisplayCondition = _this._distanceDisplayCondition;
        _this._billboardEnt.label.distanceDisplayCondition = _this._distanceDisplayCondition;
      }
      var disableDepthTestDistance = _this.disableDepthTestDistance > 10000000 ? 10000000 : _this
        .disableDepthTestDistance;
      _this._billboardEnt.billboard.disableDepthTestDistance = disableDepthTestDistance;
      _this._billboardEnt.point.disableDepthTestDistance = disableDepthTestDistance;
      _this._billboardEnt.label.disableDepthTestDistance = disableDepthTestDistance;
    }));

    // this.disposers.push(autorun(() => {
    //     this._billboardEnt.show = this.enabled && this.show;
    // }));

    _this.disposers.push((0, _mobx.autorun)(function() {
      _this._billboardEnt.point.show = _this.enabled && _this.show && _this.pointShow;
    }));

    var updateScratchCartesian1 = new Cesium.Cartesian3();
    var updateScratchCartesian2 = new Cesium.Cartesian3();
    var updateLine = function updateLine() {
      _this._billboardEnt.polyline.show = _this.enabled && _this.show && _this.lineShow;
      var p1 = Cesium.Cartesian3.fromRadians(_this.position[0], _this.position[1], _this.position[2],
        undefined, updateScratchCartesian1);
      var p2 = Cesium.Cartesian3.fromRadians(_this.position[0], _this.position[1], _this.position[2] - _this
        .lineHeight, undefined, updateScratchCartesian2);
      _this._billboardEnt.polyline.positions = [p1, p2];
    };
    updateLine();
    _this.disposers.push((0, _mobx.reaction)(function() {
      return {
        position: [].concat((0, _toConsumableArray3.default)(_this.position)),
        lineShow: _this.lineShow,
        lineHieght: _this.lineHeight
      };
    }, updateLine));

    {
      _this._mutex = new _XbsjMutex2.default();
      _this.disposers.push(function() {
        return _this._mutex = _this._mutex && _this._mutex.destroy();
      });

      var isStringValid = _XbsjMutex2.default.isStringValid;
      var setStringEmpty = _XbsjMutex2.default.setStringEmpty;

      var mutexCollection = [_XbsjMutex2.default.createObj([_this, 'imageUrl', isStringValid,
        setStringEmpty
      ]), _XbsjMutex2.default.createObj([_this.pinBuilder, 'text', isStringValid,
        setStringEmpty
      ]), _XbsjMutex2.default.createObj([_this.pinBuilder, 'makiIcon', isStringValid, setStringEmpty])];
      _this._mutex.mutexCollection = mutexCollection;
    }

    _this.disposers.push(_XbsjBase2.default.registerPathAttachedGuid(_this));
    return _this;
  }

  (0, _createClass3.default)(Pin, [{
    key: 'onmouseover',
    value: function onmouseover() {
      this._innerScale = 1.1;
    }
  }, {
    key: 'onmouseout',
    value: function onmouseout() {
      this._innerScale = 1.0;
    }
  }, {
    key: 'flyTo',
    value: function flyTo() {
      this._earth.camera.flyTo(this.position, this.viewDistance, [0, -Math.PI / 3, 0]);
    }
  }, {
    key: 'destroy',
    value: function destroy() {
      return (0, _get3.default)(Pin.prototype.__proto__ || (0, _getPrototypeOf2.default)(Pin.prototype),
        'destroy', this).call(this);
    }
  }]);
  return Pin;
}(_XbsjCzmObj3.default);

Pin.defaultOptions = {
  position: [0, 0, 0],
  // viewDistance: 100.0,
  scale: 1.0,
  imageUrl: '',
  isDivImage: false,
  origin: [0.5, 0], // 目前只能设置为0.0，0.5，1.0
  pinBuilder: {
    text: '',
    extText: '',
    extTextFont: '48px 楷体',
    extTextPixelOffset: [30, -20],
    makiIcon: '',
    size: 48,
    fillColor: [1, 1, 1, 1],
    outlineColor: [0, 0.5, 0, 1]
  },
  near: 0,
  far: Number.MAX_VALUE,
  disableDepthTestDistance: Number.MAX_VALUE, // POSITIVE_INFINITY转化为json时，会变成null！
  show: true,
  attachedPathGuid: '',

  pointShow: false,
  lineShow: false,
  lineHeight: 0, // 向下衍生长度(单位米)

  computingWinPos: true, // 是否实时计算窗口坐标

  cameraAttachedOffsetPosition: [0, 0, 0],
  cameraAttachedOffsetRotation: [0, -Math.PI / 3, 0],
  viewDistance: 100.0
};

Pin.MakiIcon = _MakiIcon2.default;

/**
 * Pin构建器
 * @memberof Obj.Pin
 * @class
 * @name PinBuilder
 */

var xbsjSchema = {
  title: "Pin Property",
  type: "object",
  properties: {
    /**
     * 显示路径
     * @type {boolean}
     * @instance
     * @default true
     * @memberof Obj.Pin
     */
    show: {
      type: "boolean",
      title: "显示路径",
      default: true,
      description: '显示路径'
    },
    /**
     * @description 原点
     * @type {array}
     * @instance
     * @default [0.5, 0]
     * @memberof Obj.Pin
     */
    origin: {
      type: "array",
      title: "原点",
      default: [0.5, 0],
      description: '原点'
    },
    /**
     * @description 位置数组 [经度、纬度、高度]
     * @type {array}
     * @instance
     * @default [0, 0, 0]
     * @memberof Obj.Pin
     */
    position: {
      type: "array",
      title: "位置数组",
      default: [0, 0, 0],
      description: '位置数组'
    },
    /**
     * 视点距离，当相机飞入时的停止距离
     * @type number
     * @instance
     * @default 100
     * @memberof Obj.Pin
     */
    viewDistance: {
      type: "number",
      title: "显示路径",
      default: 100.0,
      description: '显示路径'
    },
    /**
     * 缩放比例
     * @type number
     * @instance
     * @default 1.0
     * @memberof Obj.Pin
     */
    scale: {
      type: "number",
      title: "缩放比例",
      default: 1.0,
      description: '缩放比例'
    },
    /**
     * 图像路径
     * @type string
     * @instance
     * @default ''
     * @memberof Obj.Pin
     */
    imageUrl: {
      type: "string",
      title: "图像路径",
      default: '',
      description: '图像路径'
    },
    /**
     * image是否用div绘制
     * @type boolean
     * @instance
     * @default false
     * @memberof Obj.Pin
     */
    isDivImage: {
      type: "boolean",
      title: "image是否用div绘制",
      default: 'false',
      description: 'image是否用div绘制'
    },
    /**
     * pin构建器
     * @type {Obj.Pin.PinBuilder}
     * @instance
     * @memberof Obj.Pin
     */
    pinBuilder: {
      title: "pinBuilder属性",
      type: "object",
      properties: {
        /**
         * 文本，写在Pin中的文本
         * @type string
         * @instance
         * @memberof Obj.Pin.PinBuilder
         */
        text: {
          type: "string",
          title: "文本",
          default: '',
          description: '文本'
        },
        /**
         * 附带文本，附带在Pin右边的文本
         * @type string
         * @instance
         * @memberof Obj.Pin.PinBuilder
         */
        extText: {
          type: "string",
          title: "附带文本",
          default: '',
          description: '附带文本'
        },
        /**
         * 附带文本字体样式
         * @type string
         * @instance
         * @memberof Obj.Pin.PinBuilder
         */
        extTextFont: {
          type: "string",
          title: "附带文本字体样式",
          default: '',
          description: '附带文本字体样式'
        },
        /**
         * 附带文本的像素偏移
         * @type array
         * @instance
         * @memberof Obj.Pin.PinBuilder
         */
        extTextPixelOffset: {
          type: "array",
          title: "像素偏移",
          default: [0, 0],
          description: '像素偏移'
        },
        /**
         * 图像字符
         * @type string
         * @instance
         * @memberof Obj.Pin.PinBuilder
         */
        makiIcon: {
          type: "string",
          title: "图像字符",
          default: '',
          description: '图像字符'
        },
        /**
         * 尺寸
         * @type number
         * @instance
         * @memberof Obj.Pin.PinBuilder
         */
        size: {
          type: "number",
          title: "尺寸",
          default: 48,
          description: '尺寸'
        },
        /**
         * 填充颜色
         * @type array
         * @instance
         * @memberof Obj.Pin.PinBuilder
         */
        fillColor: {
          type: "array",
          title: "填充颜色",
          default: [1, 1, 1, 1],
          description: '填充颜色'
        },
        /**
         * 轮廓颜色
         * @type object
         * @instance
         * @memberof Obj.Pin.PinBuilder
         */
        outlineColor: {
          type: "array",
          title: "轮廓颜色",
          default: [0, 0.5, 0, 1],
          description: '轮廓颜色'
        }
      }
    },
    /**
     * 点是否可见
     * @type boolean
     * @instance
     * @default false
     * @memberof Obj.Pin
     */
    pointShow: {
      type: "boolean",
      title: "点是否可见",
      default: false,
      description: '点是否可见'
    },
    /**
     * 指示线条是否可见
     * @type boolean
     * @instance
     * @default false
     * @memberof Obj.Pin
     */
    lineShow: {
      type: "boolean",
      title: "点是否可见",
      default: false,
      description: '点是否可见'
    },
    /**
     * 指示线条长度
     * @type number
     * @instance
     * @default 0
     * @memberof Obj.Pin
     */
    lineHeight: {
      type: "number",
      title: "指示线条长度",
      default: 0,
      description: '指示线条长度'
    },
    /**
     * 最近可视距离
     * @type number
     * @instance
     * @default 0
     * @memberof Obj.Pin
     */
    near: {
      type: "number",
      title: "最近可视距离",
      default: 0,
      description: '最近可视距离'
    },
    /**
     * 最远可视距离
     * @type number
     * @instance
     * @default Number.MAX_VALUE
     * @memberof Obj.Pin
     */
    far: {
      type: "number",
      title: "最远可视距离",
      default: Number.MAX_VALUE,
      description: '最远可视距离'
    },
    /**
     * 让深度检测失效的距离（在该距离以内不论是否被遮挡，都显示），设置为0时表示始终会被遮挡。
     * @type number
     * @instance
     * @default Number.MAX_VALUE
     * @memberof Obj.Pin
     */
    disableDepthTestDistance: {
      type: "number",
      title: "深度检测失效距离",
      default: Number.MAX_VALUE,
      description: '让深度检测失效的距离（在该距离以内不论是否被遮挡，都显示），设置为0时表示始终会被遮挡。'
    }

    // disableDepthTestDistance只能设置最大值10000000，如果超过Cesium就不起作用了，导致从太空观察时，poi不绘制。

  }
};
Pin.xbsjSchema = xbsjSchema;

var xbsjClassification = [{
  name: {
    chinese: '通用',
    english: 'General'
  },
  properties: ['disableDepthTestDistance', 'far', 'imageUrl', 'isDivImage', 'near', 'origin', 'pinBuilder',
    'pointShow', 'lineShow', 'lineHeight', 'position', 'scale', 'show', 'viewDistance'
  ]
}];

Pin.xbsjClassification = xbsjClassification;

_XbsjObject2.default.registerType(Pin, 'Pin');

exports.default = Pin;

/***/
})
